// --------------------------------------------------------------------------------------------
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
// 
// The contents of this file are subject to the Mozilla Public License Version
// 1.1 (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
// http://www.mozilla.org/MPL/
// 
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
// for the specific language governing rights and limitations under the
// License.
// 
// <remarks>
// Generated by IDLImporter from file nsIXMLHttpRequest.idl
// 
// You should use these interfaces when you access the COM objects defined in the mentioned
// IDL/IDH file.
// </remarks>
// --------------------------------------------------------------------------------------------
namespace Gecko
{
	using System;
	using System.Runtime.InteropServices;
	using System.Runtime.InteropServices.ComTypes;
	using System.Runtime.CompilerServices;
	
	
	/// <summary>
    ///This Source Code Form is subject to the terms of the Mozilla Public
    /// License, v. 2.0. If a copy of the MPL was not distributed with this
    /// file, You can obtain one at http://mozilla.org/MPL/2.0/. </summary>
	[ComImport()]
	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	[Guid("88e7d2a0-2e5b-4f65-9624-a61e607a9948")]
	public interface nsIXMLHttpRequestEventTarget : nsIDOMEventTarget
	{
		
		/// <summary>
        /// This method allows the registration of event listeners on the event target.
        /// If an EventListener is added to an EventTarget while it is processing an
        /// event, it will not be triggered by the current actions but may be
        /// triggered during a later stage of event flow, such as the bubbling phase.
        ///
        /// If multiple identical EventListeners are registered on the same
        /// EventTarget with the same parameters the duplicate instances are
        /// discarded. They do not cause the EventListener to be called twice
        /// and since they are discarded they do not need to be removed with the
        /// removeEventListener method.
        ///
        /// @param   type The event type for which the user is registering
        /// @param   listener The listener parameter takes an interface
        /// implemented by the user which contains the methods
        /// to be called when the event occurs.
        /// @param   useCapture If true, useCapture indicates that the user
        /// wishes to initiate capture. After initiating
        /// capture, all events of the specified type will be
        /// dispatched to the registered EventListener before
        /// being dispatched to any EventTargets beneath them
        /// in the tree. Events which are bubbling upward
        /// through the tree will not trigger an
        /// EventListener designated to use capture.
        /// @param   wantsUntrusted If false, the listener will not receive any
        /// untrusted events (see above), if true, the
        /// listener will receive events whether or not
        /// they're trusted
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new void AddEventListener([MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Gecko.CustomMarshalers.AStringMarshaler")] nsAStringBase type, [MarshalAs(UnmanagedType.Interface)] nsIDOMEventListener listener, [MarshalAs(UnmanagedType.U1)] bool useCapture, [MarshalAs(UnmanagedType.U1)] bool wantsUntrusted, int argc);
		
		/// <summary>
        /// addSystemEventListener() adds an event listener of aType to the system
        /// group.  Typically, core code should use system group for listening to
        /// content (i.e., non-chrome) element's events.  If core code uses
        /// nsIDOMEventTarget::AddEventListener for a content node, it means
        /// that the listener cannot listen the event when web content calls
        /// stopPropagation() of the event.
        ///
        /// @param aType            An event name you're going to handle.
        /// @param aListener        An event listener.
        /// @param aUseCapture      TRUE if you want to listen the event in capturing
        /// phase.  Otherwise, FALSE.
        /// @param aWantsUntrusted  TRUE if you want to handle untrusted events.
        /// Otherwise, FALSE.
        /// @return                 NS_OK if succeed.  Otherwise, NS_ERROR_*.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new void AddSystemEventListener([MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Gecko.CustomMarshalers.AStringMarshaler")] nsAStringBase type, [MarshalAs(UnmanagedType.Interface)] nsIDOMEventListener listener, [MarshalAs(UnmanagedType.U1)] bool aUseCapture, [MarshalAs(UnmanagedType.U1)] bool aWantsUntrusted, int argc);
		
		/// <summary>
        /// This method allows the removal of event listeners from the event
        /// target. If an EventListener is removed from an EventTarget while it
        /// is processing an event, it will not be triggered by the current actions.
        /// EventListeners can never be invoked after being removed.
        /// Calling removeEventListener with arguments which do not identify any
        /// currently registered EventListener on the EventTarget has no effect.
        ///
        /// @param   type Specifies the event type of the EventListener being
        /// removed.
        /// @param   listener The EventListener parameter indicates the
        /// EventListener to be removed.
        /// @param   useCapture Specifies whether the EventListener being
        /// removed was registered as a capturing listener or
        /// not. If a listener was registered twice, one with
        /// capture and one without, each must be removed
        /// separately. Removal of a capturing listener does
        /// not affect a non-capturing version of the same
        /// listener, and vice versa.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new void RemoveEventListener([MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Gecko.CustomMarshalers.AStringMarshaler")] nsAStringBase type, [MarshalAs(UnmanagedType.Interface)] nsIDOMEventListener listener, [MarshalAs(UnmanagedType.U1)] bool useCapture);
		
		/// <summary>
        /// removeSystemEventListener() should be used if you have used
        /// addSystemEventListener().
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new void RemoveSystemEventListener([MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Gecko.CustomMarshalers.AStringMarshaler")] nsAStringBase type, [MarshalAs(UnmanagedType.Interface)] nsIDOMEventListener listener, [MarshalAs(UnmanagedType.U1)] bool aUseCapture);
		
		/// <summary>
        /// This method allows the dispatch of events into the implementations
        /// event model. Events dispatched in this manner will have the same
        /// capturing and bubbling behavior as events dispatched directly by the
        /// implementation. The target of the event is the EventTarget on which
        /// dispatchEvent is called.
        ///
        /// @param   evt Specifies the event type, behavior, and contextual
        /// information to be used in processing the event.
        /// @return  Indicates whether any of the listeners which handled the
        /// event called preventDefault. If preventDefault was called
        /// the value is false, else the value is true.
        /// @throws  INVALID_STATE_ERR: Raised if the Event's type was
        /// not specified by initializing the event before
        /// dispatchEvent was called. Specification of the Event's
        /// type as null or an empty string will also trigger this
        /// exception.
        /// </summary>
		[return: MarshalAs(UnmanagedType.U1)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new bool DispatchEvent([MarshalAs(UnmanagedType.Interface)] nsIDOMEvent evt);
		
		/// <summary>
        /// Returns the nsIDOMEventTarget object which should be used as the target
        /// of DOMEvents.
        /// Usually |this| is returned, but for example global object returns
        /// the outer object.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new nsIDOMEventTarget GetTargetForDOMEvent();
		
		/// <summary>
        /// Returns the nsIDOMEventTarget object which should be used as the target
        /// of the event and when constructing event target chain.
        /// Usually |this| is returned, but for example global object returns
        /// the inner object.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new nsIDOMEventTarget GetTargetForEventTargetChain();
		
		/// <summary>
        /// Called before the capture phase of the event flow.
        /// This is used to create the event target chain and implementations
        /// should set the necessary members of EventChainPreVisitor.
        /// At least aVisitor.mCanHandle must be set,
        /// usually also aVisitor.mParentTarget if mCanHandle is PR_TRUE.
        /// First one tells that this object can handle the aVisitor.mEvent event and
        /// the latter one is the possible parent object for the event target chain.
        /// @see EventDispatcher.h for more documentation about aVisitor.
        ///
        /// @param aVisitor the visitor object which is used to create the
        /// event target chain for event dispatching.
        ///
        /// @note Only EventDispatcher should call this method.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new void PreHandleEvent(System.IntPtr aVisitor);
		
		/// <summary>
        /// If EventChainPreVisitor.mWantsWillHandleEvent is set PR_TRUE,
        /// called just before possible event handlers on this object will be called.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new void WillHandleEvent(System.IntPtr aVisitor);
		
		/// <summary>
        /// Called after the bubble phase of the system event group.
        /// The default handling of the event should happen here.
        /// @param aVisitor the visitor object which is used during post handling.
        ///
        /// @see EventDispatcher.h for documentation about aVisitor.
        /// @note Only EventDispatcher should call this method.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new void PostHandleEvent(System.IntPtr aVisitor);
		
		/// <summary>
        /// Dispatch an event.
        /// @param aEvent the event that is being dispatched.
        /// @param aDOMEvent the event that is being dispatched, use if you want to
        /// dispatch nsIDOMEvent, not only WidgetEvent.
        /// @param aPresContext the current presentation context, can be nullptr.
        /// @param aEventStatus the status returned from the function, can be nullptr.
        ///
        /// @note If both aEvent and aDOMEvent are used, aEvent must be the internal
        /// event of the aDOMEvent.
        ///
        /// If aDOMEvent is not nullptr (in which case aEvent can be nullptr) it is used
        /// for dispatching, otherwise aEvent is used.
        ///
        /// @deprecated This method is here just until all the callers outside Gecko
        /// have been converted to use nsIDOMEventTarget::dispatchEvent.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new void DispatchDOMEvent(System.IntPtr aEvent, [MarshalAs(UnmanagedType.Interface)] nsIDOMEvent aDOMEvent, System.IntPtr aPresContext, System.IntPtr aEventStatus);
		
		/// <summary>
        /// Get the script context in which the event handlers should be run.
        /// May return null.
        /// @note Caller *must* check the value of aRv.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new System.IntPtr GetContextForEventHandlers(ref int aRv);
		
		/// <summary>
        /// If the method above returns null, but a success code, this method
        /// is called.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new System.IntPtr GetJSContextForEventHandlers();
	}
	
	/// <summary>
    /// event handler attributes
    /// </summary>
	[ComImport()]
	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	[Guid("d74c4dc4-bc8c-4f5d-b7f1-121a48750abe")]
	public interface nsIXMLHttpRequestUpload : nsIXMLHttpRequestEventTarget
	{
		
		/// <summary>
        /// This method allows the registration of event listeners on the event target.
        /// If an EventListener is added to an EventTarget while it is processing an
        /// event, it will not be triggered by the current actions but may be
        /// triggered during a later stage of event flow, such as the bubbling phase.
        ///
        /// If multiple identical EventListeners are registered on the same
        /// EventTarget with the same parameters the duplicate instances are
        /// discarded. They do not cause the EventListener to be called twice
        /// and since they are discarded they do not need to be removed with the
        /// removeEventListener method.
        ///
        /// @param   type The event type for which the user is registering
        /// @param   listener The listener parameter takes an interface
        /// implemented by the user which contains the methods
        /// to be called when the event occurs.
        /// @param   useCapture If true, useCapture indicates that the user
        /// wishes to initiate capture. After initiating
        /// capture, all events of the specified type will be
        /// dispatched to the registered EventListener before
        /// being dispatched to any EventTargets beneath them
        /// in the tree. Events which are bubbling upward
        /// through the tree will not trigger an
        /// EventListener designated to use capture.
        /// @param   wantsUntrusted If false, the listener will not receive any
        /// untrusted events (see above), if true, the
        /// listener will receive events whether or not
        /// they're trusted
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new void AddEventListener([MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Gecko.CustomMarshalers.AStringMarshaler")] nsAStringBase type, [MarshalAs(UnmanagedType.Interface)] nsIDOMEventListener listener, [MarshalAs(UnmanagedType.U1)] bool useCapture, [MarshalAs(UnmanagedType.U1)] bool wantsUntrusted, int argc);
		
		/// <summary>
        /// addSystemEventListener() adds an event listener of aType to the system
        /// group.  Typically, core code should use system group for listening to
        /// content (i.e., non-chrome) element's events.  If core code uses
        /// nsIDOMEventTarget::AddEventListener for a content node, it means
        /// that the listener cannot listen the event when web content calls
        /// stopPropagation() of the event.
        ///
        /// @param aType            An event name you're going to handle.
        /// @param aListener        An event listener.
        /// @param aUseCapture      TRUE if you want to listen the event in capturing
        /// phase.  Otherwise, FALSE.
        /// @param aWantsUntrusted  TRUE if you want to handle untrusted events.
        /// Otherwise, FALSE.
        /// @return                 NS_OK if succeed.  Otherwise, NS_ERROR_*.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new void AddSystemEventListener([MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Gecko.CustomMarshalers.AStringMarshaler")] nsAStringBase type, [MarshalAs(UnmanagedType.Interface)] nsIDOMEventListener listener, [MarshalAs(UnmanagedType.U1)] bool aUseCapture, [MarshalAs(UnmanagedType.U1)] bool aWantsUntrusted, int argc);
		
		/// <summary>
        /// This method allows the removal of event listeners from the event
        /// target. If an EventListener is removed from an EventTarget while it
        /// is processing an event, it will not be triggered by the current actions.
        /// EventListeners can never be invoked after being removed.
        /// Calling removeEventListener with arguments which do not identify any
        /// currently registered EventListener on the EventTarget has no effect.
        ///
        /// @param   type Specifies the event type of the EventListener being
        /// removed.
        /// @param   listener The EventListener parameter indicates the
        /// EventListener to be removed.
        /// @param   useCapture Specifies whether the EventListener being
        /// removed was registered as a capturing listener or
        /// not. If a listener was registered twice, one with
        /// capture and one without, each must be removed
        /// separately. Removal of a capturing listener does
        /// not affect a non-capturing version of the same
        /// listener, and vice versa.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new void RemoveEventListener([MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Gecko.CustomMarshalers.AStringMarshaler")] nsAStringBase type, [MarshalAs(UnmanagedType.Interface)] nsIDOMEventListener listener, [MarshalAs(UnmanagedType.U1)] bool useCapture);
		
		/// <summary>
        /// removeSystemEventListener() should be used if you have used
        /// addSystemEventListener().
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new void RemoveSystemEventListener([MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Gecko.CustomMarshalers.AStringMarshaler")] nsAStringBase type, [MarshalAs(UnmanagedType.Interface)] nsIDOMEventListener listener, [MarshalAs(UnmanagedType.U1)] bool aUseCapture);
		
		/// <summary>
        /// This method allows the dispatch of events into the implementations
        /// event model. Events dispatched in this manner will have the same
        /// capturing and bubbling behavior as events dispatched directly by the
        /// implementation. The target of the event is the EventTarget on which
        /// dispatchEvent is called.
        ///
        /// @param   evt Specifies the event type, behavior, and contextual
        /// information to be used in processing the event.
        /// @return  Indicates whether any of the listeners which handled the
        /// event called preventDefault. If preventDefault was called
        /// the value is false, else the value is true.
        /// @throws  INVALID_STATE_ERR: Raised if the Event's type was
        /// not specified by initializing the event before
        /// dispatchEvent was called. Specification of the Event's
        /// type as null or an empty string will also trigger this
        /// exception.
        /// </summary>
		[return: MarshalAs(UnmanagedType.U1)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new bool DispatchEvent([MarshalAs(UnmanagedType.Interface)] nsIDOMEvent evt);
		
		/// <summary>
        /// Returns the nsIDOMEventTarget object which should be used as the target
        /// of DOMEvents.
        /// Usually |this| is returned, but for example global object returns
        /// the outer object.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new nsIDOMEventTarget GetTargetForDOMEvent();
		
		/// <summary>
        /// Returns the nsIDOMEventTarget object which should be used as the target
        /// of the event and when constructing event target chain.
        /// Usually |this| is returned, but for example global object returns
        /// the inner object.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new nsIDOMEventTarget GetTargetForEventTargetChain();
		
		/// <summary>
        /// Called before the capture phase of the event flow.
        /// This is used to create the event target chain and implementations
        /// should set the necessary members of EventChainPreVisitor.
        /// At least aVisitor.mCanHandle must be set,
        /// usually also aVisitor.mParentTarget if mCanHandle is PR_TRUE.
        /// First one tells that this object can handle the aVisitor.mEvent event and
        /// the latter one is the possible parent object for the event target chain.
        /// @see EventDispatcher.h for more documentation about aVisitor.
        ///
        /// @param aVisitor the visitor object which is used to create the
        /// event target chain for event dispatching.
        ///
        /// @note Only EventDispatcher should call this method.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new void PreHandleEvent(System.IntPtr aVisitor);
		
		/// <summary>
        /// If EventChainPreVisitor.mWantsWillHandleEvent is set PR_TRUE,
        /// called just before possible event handlers on this object will be called.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new void WillHandleEvent(System.IntPtr aVisitor);
		
		/// <summary>
        /// Called after the bubble phase of the system event group.
        /// The default handling of the event should happen here.
        /// @param aVisitor the visitor object which is used during post handling.
        ///
        /// @see EventDispatcher.h for documentation about aVisitor.
        /// @note Only EventDispatcher should call this method.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new void PostHandleEvent(System.IntPtr aVisitor);
		
		/// <summary>
        /// Dispatch an event.
        /// @param aEvent the event that is being dispatched.
        /// @param aDOMEvent the event that is being dispatched, use if you want to
        /// dispatch nsIDOMEvent, not only WidgetEvent.
        /// @param aPresContext the current presentation context, can be nullptr.
        /// @param aEventStatus the status returned from the function, can be nullptr.
        ///
        /// @note If both aEvent and aDOMEvent are used, aEvent must be the internal
        /// event of the aDOMEvent.
        ///
        /// If aDOMEvent is not nullptr (in which case aEvent can be nullptr) it is used
        /// for dispatching, otherwise aEvent is used.
        ///
        /// @deprecated This method is here just until all the callers outside Gecko
        /// have been converted to use nsIDOMEventTarget::dispatchEvent.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new void DispatchDOMEvent(System.IntPtr aEvent, [MarshalAs(UnmanagedType.Interface)] nsIDOMEvent aDOMEvent, System.IntPtr aPresContext, System.IntPtr aEventStatus);
		
		/// <summary>
        /// Get the script context in which the event handlers should be run.
        /// May return null.
        /// @note Caller *must* check the value of aRv.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new System.IntPtr GetContextForEventHandlers(ref int aRv);
		
		/// <summary>
        /// If the method above returns null, but a success code, this method
        /// is called.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		new System.IntPtr GetJSContextForEventHandlers();
	}
	
	/// <summary>
    /// Mozilla's XMLHttpRequest is modelled after Microsoft's IXMLHttpRequest
    /// object. The goal has been to make Mozilla's version match Microsoft's
    /// version as closely as possible, but there are bound to be some differences.
    ///
    /// In general, Microsoft's documentation for IXMLHttpRequest can be used.
    /// Mozilla's interface definitions provide some additional documentation. The
    /// web page to look at is http://www.mozilla.org/xmlextras/
    ///
    /// Mozilla's XMLHttpRequest object can be created in JavaScript like this:
    /// new XMLHttpRequest()
    /// compare to Internet Explorer:
    /// new ActiveXObject("Msxml2.XMLHTTP")
    ///
    /// From JavaScript, the methods and properties visible in the XMLHttpRequest
    /// object are a combination of nsIXMLHttpRequest and nsIJSXMLHttpRequest;
    /// there is no need to differentiate between those interfaces.
    ///
    /// From native code, the way to set up onload and onerror handlers is a bit
    /// different. Here is a comment from Johnny Stenback <jst@netscape.com>:
    ///
    /// The mozilla implementation of nsIXMLHttpRequest implements the interface
    /// nsIDOMEventTarget and that's how you're supported to add event listeners.
    /// Try something like this:
    ///
    /// nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(myxmlhttpreq));
    ///
    /// target->AddEventListener(NS_LITERAL_STRING("load"), mylistener,
    /// PR_FALSE)
    ///
    /// where mylistener is your event listener object that implements the
    /// interface nsIDOMEventListener.
    ///
    /// The 'onload', 'onerror', and 'onreadystatechange' attributes moved to
    /// nsIJSXMLHttpRequest, but if you're coding in C++ you should avoid using
    /// those.
    ///
    /// Conclusion: Do not use event listeners on XMLHttpRequest from C++, unless
    /// you're aware of all the security implications.  And then think twice about
    /// it.
    /// </summary>
	[ComImport()]
	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	[Guid("6f54214c-7175-498d-9d2d-0429e38c2869")]
	public interface nsIXMLHttpRequest
	{
		
		/// <summary>
        /// The request uses a channel in order to perform the
        /// request.  This attribute represents the channel used
        /// for the request.  NULL if the channel has not yet been
        /// created.
        ///
        /// Mozilla only. Requires elevated privileges to access.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIChannel GetChannelAttribute();
		
		/// <summary>
        /// The response to the request is parsed as if it were a
        /// text/xml stream. This attributes represents the response as
        /// a DOM Document object. NULL if the request is unsuccessful or
        /// has not yet been sent.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIDOMDocument GetResponseXMLAttribute();
		
		/// <summary>
        /// The response to the request as text.
        /// NULL if the request is unsuccessful or
        /// has not yet been sent.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void GetResponseTextAttribute([MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Gecko.CustomMarshalers.AStringMarshaler")] nsAStringBase aResponseText);
		
		/// <summary>
        /// Determine a response format which response attribute returns.
        /// empty string (initial value) or "text": as text.
        /// "arraybuffer": as a typed array ArrayBuffer.
        /// "blob": as a File API Blob.
        /// "document": as a DOM Document object.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void GetResponseTypeAttribute([MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Gecko.CustomMarshalers.AStringMarshaler")] nsAStringBase aResponseType);
		
		/// <summary>
        /// Determine a response format which response attribute returns.
        /// empty string (initial value) or "text": as text.
        /// "arraybuffer": as a typed array ArrayBuffer.
        /// "blob": as a File API Blob.
        /// "document": as a DOM Document object.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void SetResponseTypeAttribute([MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Gecko.CustomMarshalers.AStringMarshaler")] nsAStringBase aResponseType);
		
		/// <summary>
        ///any </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		Gecko.JsVal GetResponseAttribute(System.IntPtr jsContext);
		
		/// <summary>
        /// XXX spec says unsigned short
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		uint GetStatusAttribute();
		
		/// <summary>
        /// The string representing the status of the response for
        /// HTTP requests.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void GetStatusTextAttribute([MarshalAs(UnmanagedType.LPStruct)] nsACStringBase aStatusText);
		
		/// <summary>
        /// If the request has been sent already, this method will
        /// abort the request.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void Abort();
		
		/// <summary>
        /// Returns all of the response headers as a string for HTTP
        /// requests.
        ///
        /// @returns A string containing all of the response headers.
        /// The empty string if the response has not yet been received.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void GetAllResponseHeaders([MarshalAs(UnmanagedType.LPStruct)] nsACStringBase retval);
		
		/// <summary>
        /// Returns the text of the header with the specified name for
        /// HTTP requests.
        ///
        /// @param header The name of the header to retrieve
        /// @returns A string containing the text of the header specified.
        /// NULL if the response has not yet been received or the
        /// header does not exist in the response.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void GetResponseHeader([MarshalAs(UnmanagedType.LPStruct)] nsACStringBase header, [MarshalAs(UnmanagedType.LPStruct)] nsACStringBase retval);
		
		/// <summary>
        /// Meant to be a script-only method for initializing a request.
        ///
        /// If there is an "active" request (that is, if open() has been called
        /// already), this is equivalent to calling abort() and then open().
        ///
        /// @param method The HTTP method - either "POST" or "GET". Ignored
        /// if the URL is not a HTTP URL.
        /// @param url The URL to which to send the request.
        /// @param async (optional) Whether the request is synchronous or
        /// asynchronous i.e. whether send returns only after
        /// the response is received or if it returns immediately after
        /// sending the request. In the latter case, notification
        /// of completion is sent through the event listeners.
        /// The default value is true.
        /// @param user (optional) A username for authentication if necessary.
        /// The default value is the empty string
        /// @param password (optional) A password for authentication if necessary.
        /// The default value is the empty string
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void Open([MarshalAs(UnmanagedType.LPStruct)] nsACStringBase method, [MarshalAs(UnmanagedType.LPStruct)] nsAUTF8StringBase url, [MarshalAs(UnmanagedType.U1)] bool async, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Gecko.CustomMarshalers.AStringMarshaler")] nsAStringBase user, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Gecko.CustomMarshalers.AStringMarshaler")] nsAStringBase password, int argc);
		
		/// <summary>
        /// Sends the request. If the request is asynchronous, returns
        /// immediately after sending the request. If it is synchronous
        /// returns only after the response has been received.
        ///
        /// All event listeners must be set before calling send().
        ///
        /// After the initial response, all event listeners will be cleared.
        /// // XXXbz what does that mean, exactly?
        ///
        /// @param body Either an instance of nsIDOMDocument, nsIInputStream
        /// or a string (nsISupportsString in the native calling
        /// case). This is used to populate the body of the
        /// HTTP request if the HTTP request method is "POST".
        /// If the parameter is a nsIDOMDocument, it is serialized.
        /// If the parameter is a nsIInputStream, then it must be
        /// compatible with nsIUploadChannel.setUploadStream, and a
        /// Content-Length header will be added to the HTTP request
        /// with a value given by nsIInputStream.available.  Any
        /// headers included at the top of the stream will be
        /// treated as part of the message body.  The MIME type of
        /// the stream should be specified by setting the Content-
        /// Type header via the setRequestHeader method before
        /// calling send.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void Send([MarshalAs(UnmanagedType.Interface)] nsIVariant body);
		
		/// <summary>
        /// Sets a HTTP request header for HTTP requests. You must call open
        /// before setting the request headers.
        ///
        /// @param header The name of the header to set in the request.
        /// @param value The body of the header.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void SetRequestHeader([MarshalAs(UnmanagedType.LPStruct)] nsACStringBase header, [MarshalAs(UnmanagedType.LPStruct)] nsACStringBase value);
		
		/// <summary>
        /// The amount of milliseconds a request can take before being terminated.
        /// Initially zero. Zero means there is no timeout.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		uint GetTimeoutAttribute();
		
		/// <summary>
        /// The amount of milliseconds a request can take before being terminated.
        /// Initially zero. Zero means there is no timeout.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void SetTimeoutAttribute(uint aTimeout);
		
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		ushort GetReadyStateAttribute();
		
		/// <summary>
        /// Override the mime type returned by the server (if any). This may
        /// be used, for example, to force a stream to be treated and parsed
        /// as text/xml, even if the server does not report it as such. This
        /// must be done before the <code>send</code> method is invoked.
        ///
        /// @param mimetype The type used to override that returned by the server
        /// (if any).
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void OverrideMimeType([MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Gecko.CustomMarshalers.AStringMarshaler")] nsAStringBase mimetype);
		
		/// <summary>
        /// Set to true if this is a background service request. This will
        /// prevent a load group being associated with the request, and
        /// suppress any security dialogs from being shown * to the user.
        /// In the cases where one of those dialogs would be shown, the request
        /// will simply fail instead.
        /// </summary>
		[return: MarshalAs(UnmanagedType.U1)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		bool GetMozBackgroundRequestAttribute();
		
		/// <summary>
        /// Set to true if this is a background service request. This will
        /// prevent a load group being associated with the request, and
        /// suppress any security dialogs from being shown * to the user.
        /// In the cases where one of those dialogs would be shown, the request
        /// will simply fail instead.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void SetMozBackgroundRequestAttribute([MarshalAs(UnmanagedType.U1)] bool aMozBackgroundRequest);
		
		/// <summary>
        /// When set to true attempts to make cross-site Access-Control requests
        /// with credentials such as cookies and authorization headers.
        ///
        /// Never affects same-site requests.
        ///
        /// Defaults to false.
        /// </summary>
		[return: MarshalAs(UnmanagedType.U1)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		bool GetWithCredentialsAttribute();
		
		/// <summary>
        /// When set to true attempts to make cross-site Access-Control requests
        /// with credentials such as cookies and authorization headers.
        ///
        /// Never affects same-site requests.
        ///
        /// Defaults to false.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void SetWithCredentialsAttribute([MarshalAs(UnmanagedType.U1)] bool aWithCredentials);
		
		/// <summary>
        /// Initialize the object for use from C++ code with the principal, script
        /// context, and owner window that should be used.
        ///
        /// @param principal The principal to use for the request. This must not be
        /// null.
        /// @param scriptContext The script context to use for the request. May be
        /// null.
        /// @param globalObject The associated global for the request. Can be the
        /// outer window, a sandbox, or a backstage pass.
        /// May be null, but then the request cannot create a
        /// document.
        /// @param baseURI The base URI to use when resolving relative URIs. May be
        /// null.
        /// @param loadGroup An optional load group to use when performing the request.
        /// This will be used even if the global has a window with a
        /// load group.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void Init([MarshalAs(UnmanagedType.Interface)] nsIPrincipal principal, System.IntPtr scriptContext, System.IntPtr globalObject, [MarshalAs(UnmanagedType.Interface)] nsIURI baseURI, [MarshalAs(UnmanagedType.Interface)] nsILoadGroup loadGroup);
		
		/// <summary>
        /// Upload process can be tracked by adding event listener to |upload|.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIXMLHttpRequestUpload GetUploadAttribute();
		
		/// <summary>
        /// Meant to be a script-only mechanism for setting a callback function.
        /// The attribute is expected to be JavaScript function object. When the
        /// readyState changes, the callback function will be called.
        /// This attribute should not be used from native code!!
        ///
        /// After the initial response, all event listeners will be cleared.
        /// // XXXbz what does that mean, exactly?
        ///
        /// Call open() before setting an onreadystatechange listener.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		Gecko.JsVal GetOnreadystatechangeAttribute(System.IntPtr jsContext);
		
		/// <summary>
        /// Meant to be a script-only mechanism for setting a callback function.
        /// The attribute is expected to be JavaScript function object. When the
        /// readyState changes, the callback function will be called.
        /// This attribute should not be used from native code!!
        ///
        /// After the initial response, all event listeners will be cleared.
        /// // XXXbz what does that mean, exactly?
        ///
        /// Call open() before setting an onreadystatechange listener.
        /// </summary>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void SetOnreadystatechangeAttribute(Gecko.JsVal aOnreadystatechange, System.IntPtr jsContext);
		
		/// <summary>
        /// If true, the request will be sent without cookie and authentication
        /// headers.
        /// </summary>
		[return: MarshalAs(UnmanagedType.U1)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		bool GetMozAnonAttribute();
		
		/// <summary>
        /// If true, the same origin policy will not be enforced on the request.
        /// </summary>
		[return: MarshalAs(UnmanagedType.U1)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		bool GetMozSystemAttribute();
	}
	
	/// <summary>nsIXMLHttpRequestConsts </summary>
	public class nsIXMLHttpRequestConsts
	{
		
		// <summary>
        // The state of the request.
        //
        // Possible values:
        // 0 UNSENT   open() has not been called yet.
        // 1 OPENED   send() has not been called yet.
        // 2 HEADERS_RECEIVED
        // send() has been called, headers and status are available.
        // 3 LOADING  Downloading, responseText holds the partial data.
        // 4 DONE     Finished with all operations.
        // </summary>
		public const ushort UNSENT = 0;
		
		// 
		public const ushort OPENED = 1;
		
		// 
		public const ushort HEADERS_RECEIVED = 2;
		
		// 
		public const ushort LOADING = 3;
		
		// 
		public const ushort DONE = 4;
	}
	
	/// <summary>nsIXHRSendable </summary>
	[ComImport()]
	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	[Guid("840d0d00-e83e-4a29-b3c7-67e96e90a499")]
	public interface nsIXHRSendable
	{
		
		/// <summary>Member GetSendInfo </summary>
		/// <param name='body'> </param>
		/// <param name='contentLength'> </param>
		/// <param name='contentType'> </param>
		/// <param name='charset'> </param>
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		void GetSendInfo([MarshalAs(UnmanagedType.Interface)] ref nsIInputStream body, ref ulong contentLength, [MarshalAs(UnmanagedType.LPStruct)] nsACStringBase contentType, [MarshalAs(UnmanagedType.LPStruct)] nsACStringBase charset);
	}
	
	/// <summary>
    /// @deprecated
    /// </summary>
	[ComImport()]
	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	[Guid("8ae70a39-edf1-40b4-a992-472d23421c25")]
	public interface nsIJSXMLHttpRequest
	{
	}
}
